<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:faces="http://java.sun.com/jsf/composite/faces/components"
	xmlns:facesex="http://www.onionframework.org/components/facesex"
    template="/faces/template/list.xhtml">
	
	<ui:define name="head">
		<ui:param name="action" value="#{faces.food}" />
		<ui:param name="editView" value="/food/foodEdit.xhtml" />
	</ui:define>

	<ui:define name="queryFields">
		<faces:formBox title="查询区" closeable="true">
			<faces:inputTextItem label="名称" required="true" value="#{action.queryParams.name_like}"/>
			<faces:inputTextItem label="重量大于" value="#{action.queryParams.weight_gt}"/>
			<faces:inputDateItem label="创建时间小于" styleClass="block" value="#{action.queryParams.createTime_lt}"/>
		</faces:formBox>
		<div class="formBox_buttons">
			<a4j:commandButton value="查询" styleClass="formBox_commonButton" 
				action="#{action.query}" reRender="dataTable dataTableTools"/>
			<input type="reset" class="formBox_commonButton" value="重置"/>
		</div>
	</ui:define>

	<!-- 按钮区 -->
	<ui:define name="listButtons">
		<faces:commonButtons actionBean="#{action}" editView="#{editView}"/>
	</ui:define>
	<!-- 表格工具区 -->
	<ui:define name="tableTools">
		<!-- 表格每页显示记录数组件，以及翻页组件 -->
		<faces:tableTools id="dataTableTools" for="dataTable" dataCount="#{action.datas.count}"/>
	</ui:define>
	<ui:define name="table">
		<rich:dataTable id="dataTable" styleClass="dataTable" rowKeyVar="key"
			rows="#{action.datas.pageSize}" binding="#{dataTable.table}"
            value="#{action.datas}" var="item"
			onrowclick="onion.faces.list.selectRow(this,event);"
			onrowmouseover="onion.faces.list.addHover(this,event);"
			onrowmouseout="onion.faces.list.removeHover(this,event);"  
			onrowdblclick="onion.faces.list.dblClick(this,null,event);"
            rowClasses="odd,even">
            <rich:column styleClass="checkboxcell" headerClass="checkboxcell">
                <f:facet name="header">
                    <input type="checkbox" onclick="onion.faces.list.checkAllRows(this,event);"/>
                </f:facet>
                <h:selectBooleanCheckbox styleClass="#{key}" onclick="onion.faces.list.checkRow(this,event);" 
					valueChangeListener="#{dataTable.selectChanged}" />
                <span class="hiddenId">#{item.id}</span>
            </rich:column>
            <rich:column  styleClass="rowKey">
                <f:facet name="header">序号</f:facet>
                #{key + 1}
            </rich:column>
			<rich:column>
				<f:facet name="header">名称 </f:facet>
				#{item.name}
			</rich:column>
			<rich:column>
				<f:facet name="header">重量 </f:facet>
				#{item.weight}
			</rich:column>
		</rich:dataTable>
	</ui:define>
	<ui:define name="listFooter">
		<rich:notifyMessages nonblocking="false" globalOnly="#{systemConfig.config.getBoolean('validateMessageAfterInput',true)}" showCloseButton="true"/>
	</ui:define>
</ui:composition>